package com.liu.controller;

import com.liu.entity.Complaint;
import com.liu.service.intf.ComplaintService;
import com.liu.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/api/complaint/")
public class ComplaintController {
    @Autowired
    private ComplaintService service;

    //新增
    @PostMapping("save.do")
    public R save(Complaint complaint) {
        return service.save(complaint);
    }

    //修改
    @PostMapping("update.do")
    public R update(Complaint complaint) {
        return service.update(complaint);
    }

    //删除
    @PostMapping("del.do")
    public R del(int id) {
        return service.del(id);
    }

    //查询
    @GetMapping("page.do")
    public com.liu.vo.PageBean page(int page, int limit) {
        return service.queryPage(page, limit);
    }

    //查询 条件
    @GetMapping("pagewhere.do")
    public com.liu.vo.PageBean page(String info, int page, int limit) {
        return service.queryPageWhere(info, page, limit);
    }

    //批量删除 JSON格式的数据请求
    @PostMapping("delbatch.do")
    public R del(@RequestBody int[] ids) {
        return service.delBatch(ids);
    }
}